#include <stdio.h>
#include <memory.h>

typedef struct Piece 
{
    char type;  /* G=general, R=chariot, H=horse, C=cannon */
    int  i;     /* row; 1 <= i <= 10 */
    int  j;     /* col; 1 <= j <= 9 */
} Piece;

#define MAX_PIECES  7

static Piece boss = {'G'};          /* position of my general */
static Piece pieces[MAX_PIECES];    /* opponent's pieces */
static int num_pieces;              /* number of opponent's pieces */
static char board[11][10];          /* current board state */

#define Min(a, b) ((a) < (b)? (a) : (b))
#define Max(a, b) ((a) > (b)? (a) : (b))

/* Count the number of pieces in between (i1,j1) and (i2,j2), exclusive.
 * Either i1 == i2 or j1 == j2 must be satisfied, otherwise -1 is returned.
 */
static int count_in_between(int i1, int j1, int i2, int j2)
{
    if (i1 == i2)
    {
        int j, count = 0;
        for (j = Min(j1,j2) + 1; j < Max(j1,j2); j++)
            if (board[i1][j])
                count++;
        return count;
    }

    if (j1 == j2)
    {
        int i, count = 0;
        for (i = Min(i1,i2) + 1; i < Max(i1,i2); i++)
            if (board[i][j1])
                count++;
        return count;
    }
    
    return -1;
}

/* Check whether our general at location (i, j) is being checked. */
static int is_checked(int boss_i, int boss_j)
{
    int k;
    for (k = 0; k < num_pieces; k++)
    {
        int checked = 0;
        Piece p = pieces[k];
        if (p.i == boss_i && p.j == boss_j) /* eaten already */
            continue;

        switch (p.type)
        {
        case 'G': /* general */
            checked = (count_in_between(p.i, p.j, boss_i, boss_j) == 0);
            break;
        case 'R': /* chariot */
            checked = (count_in_between(p.i, p.j, boss_i, boss_j) == 0);
            break;
        case 'C': /* cannon */
            checked = (count_in_between(p.i, p.j, boss_i, boss_j) == 1);
            break;
        case 'H': /* horse */
            if (p.i == boss_i - 1 && p.j == boss_j - 2)
                checked = (board[p.i][p.j+1] == 0);
            else if (p.i == boss_i - 1 && p.j == boss_j + 2)
                checked = (board[p.i][p.j-1] == 0);
            else if (p.i == boss_i + 1 && p.j == boss_j - 2)
                checked = (board[p.i][p.j+1] == 0);
            else if (p.i == boss_i + 1 && p.j == boss_j + 2)
                checked = (board[p.i][p.j-1] == 0);
            else if (p.i == boss_i - 2 && p.j == boss_j - 1)
                checked = (board[p.i+1][p.j] == 0);
            else if (p.i == boss_i + 2 && p.j == boss_j - 1)
                checked = (board[p.i-1][p.j] == 0);
            else if (p.i == boss_i - 2 && p.j == boss_j + 1)
                checked = (board[p.i+1][p.j] == 0);
            else if (p.i == boss_i + 2 && p.j == boss_j + 1)
                checked = (board[p.i-1][p.j] == 0);
            break;
        }
        if (checked)
            return 1;
    }
    return 0;
}

static int is_checkmate()
{    
#if 0
    /* Check if our general can fly to opponent's general directly. */
    for (i = boss.i + 1; i <= 10 && board[i][boss.j] == 0; i++);
    if (i <= 10 && board[i][boss.j] == 'G')
        return 0;
#endif

    /* Try move our general to each of the four possible directions. */
    if (boss.i >= 2 && !is_checked(boss.i-1, boss.j))
        return 0;
    if (boss.i <= 2 && !is_checked(boss.i+1, boss.j))
        return 0;
    if (boss.j >= 5 && !is_checked(boss.i, boss.j-1))
        return 0;
    if (boss.j <= 5 && !is_checked(boss.i, boss.j+1))
        return 0;

    return 1;
}

int main()
{
    while (scanf("%d %d %d", &num_pieces, &boss.i, &boss.j) == 3 
        && !(num_pieces == 0 && boss.i == 0 && boss.j == 0))
    {
        int k;
        memset(board, 0, sizeof(board));
        for (k = 0; k < num_pieces; k++)
        {
            char buf[10];
            int i, j;
            scanf("%s %d %d", buf, &i, &j);
            if (boss.i > 5)
                i = 11 - i;

            pieces[k].i = i;
            pieces[k].j = j;
            pieces[k].type = buf[0];
            board[i][j] = pieces[k].type;
        }
        if (boss.i > 5)
            boss.i = 11 - boss.i;
        printf("%s\n", is_checkmate()? "YES" : "NO");
    }
    return 0;
}
